<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>所有图书</title>
<script type="text/javascript">
	function validate() {
		var page = document.getElementsByName("page")[0].value;
		if (page > <s:property value="pageBean.totalPage"/>) {
			alert("你输入的页数大于最大页数，页面将跳转到首页！");
			window.document.location.href = "globalAction";
			return false;
		}
		return true;
	}
</script>
<link rel="stylesheet" type="text/css" href="default.css" />
</head>
<div id="outer">
	<div align="right">
		<s:if test="#session.username != null">
			<h2>
				欢迎您,
				<s:property value="#session.username" />
				&nbsp; <a href="user_logout">退出登录</a>
			</h2>
		</s:if>
		<s:else>
			<a href="index.jsp">登录/注册</a>
		</s:else>
	</div>
	<div id="header">
		<h1>所有图书</h1>
		<div id="menu">
			<ul>
				<li class="first"><a href="globalAction">主页</a></li>
				<li><a href="#">求书区</a></li>
				<li><a href="addBook.jsp">一键发布</a></li>
				<li><a href="allBook">所有图书</a></li>
			</ul>
		</div>
	</div>

	<div id="inner">

		<div id="main">
			<div id="main_inner">

				<!-- Main start -->

				<h2>所有图书</h2>
				<div class="content">
					<s:iterator value="pageBean.list" id="book">
						<!--<s:property value="#book.bookname" /> -->
						<a href="detailBook?id=<s:property value="#book.id" />"> <img
							src="<s:property value="#book.url" />" class="cpic right"
							alt="<s:property value="" />" />
						</a>

					</s:iterator>
				</div>
			</div>
		</div>

		<div id="side">
			<!-- Side start -->

			<h3>
				<strong>lorem</strong> ipsum dolor
			</h3>
			<div class="content"></div>

			<h3>
				<strong>lorem</strong> ipsum dolor
			</h3>
			<div class="content">
				<ul>

				</ul>
			</div>

			<!-- Side end -->
		</div>
		<div id="xbgB" class="foot"></div>
	</div>

	<div align="center">
		<font size="1">共<font color="red"><s:property
					value="pageBean.totalPage" /></font>页
		</font>&nbsp;&nbsp; <font size="1">共<font color="red"><s:property
					value="pageBean.allRows" /></font>条记录
		</font> <br> <br>

		<s:if test="pageBean.currentPage == 1">首页&nbsp;&nbsp;&nbsp;上一页</s:if>
		<s:else>
			<a href="globalAction">首页</a>
            				&nbsp;&nbsp;&nbsp;
           				<a
				href="allBook?page=<s:property value="pageBean.currentPage - 1"/>">上一页</a>
		</s:else>

		<s:if test="pageBean.currentPage != pageBean.totalPage">
			<a
				href="allBook.action?page=<s:property value="pageBean.currentPage + 1"/>">下一页</a>
            			&nbsp;&nbsp;&nbsp;
            			<a
				href="allBook?page=<s:property value="pageBean.totalPage"/>">尾页</a>
		</s:if>
		<s:else>
            			下一页&nbsp;&nbsp;&nbsp;尾页 &nbsp;
        			</s:else>
		&nbsp;&nbsp;当前在第 <font color="red"> <s:if test="page == 0">
				<s:property value="page+1" />
			</s:if> <s:else>
				<s:property value="page" />
			</s:else>
		</font>页 <br>
		<form action="allBook" onsubmit="return validate();">
			<font size="4">跳转至</font> <input type="text" size="2" name="page">页
			<input type="submit" value="跳转">
		</form>
	</div>
	<br>
</div>



<div id="footer">
	&copy; 2008 MyWebsiteName. Design by <a
		href="http://www.nodethirtythree.com">NodeThirtyThree</a> + <a
		href="http://www.freecsstemplates.org/">Free CSS Templates</a>
</div>
<s:debug></s:debug>
<body>
</body>
</html>